function ajaxcyt2001a(ssPop, ssGene)
{
	var objElements = document.forms[0].elements;	
  	var iTotElem = objElements.length;
	var iI;
	var sChain = "";
	var sCode = "";
	var sPFreq = "";
	var fPFreq = 0.0;
	var iBand = 0;
	var sCytokine = "";
	var sPop = "";
	var sGene = "";
	var sObject1;

	ajaxcyt2001a_del(ssPop, ssGene);		
  	for(iI = 0; iI < iTotElem; iI++)
  	{	
    	if((objElements[iI].type == "text"))
		{
			if(objElements[iI].name== "txtpfreq")
			{
				sObject1 = objElements[iI].name;
				sCode = objElements[iI].id;
				sCode = sCode.substring(8);
				sCytokine = sCode.substring(28);
				sPop = sCode.substring(0,8);
				sGene = sCode.substring(8,20);				
				if(objElements[iI].value!="")
				{
					fPFreq = parseFloat(objElements[iI].value);					
					sPFreq = objElements[iI].value;
				}
				else
				{
					sPFreq = "";
				}
				//... Compare if at least one of the frequencies has a value ...//
				if(sPFreq != "")
				{
					alert("Saving Data...\n\n\n" + "Population:\t" + sPop + "\nGene:\t\t" + sGene + "\nCytokine:\t\t" + sCytokine + "\nFrequency:\t" + sPFreq);
					ajaxcyt2001a_ins(sPop, sGene, sCytokine, sPFreq);
					iBand = 1;
				}
			}
		}
	}
	if(iBand==1)
	{
		//ajaxcyt2001a_upt(ssPop, ssGene);
		alert("Your data has been saved. Please continue filling other gene or exit this module.");
		document.getElementById(sObject1).focus();
	}
	else
	{
		alert("There is not data to save. Please fill information and then click save.");
	}	
  	return false;	
}
function ajaxcyt2001a_del(sCytf_popid, sCytf_gene)
{
    var xmlHttp;
	var sURL = "ajaxcyt2001a_del.asp";
	
	try
    {  
         // Firefox, Opera 8.0+, Safari  
         xmlHttp=new XMLHttpRequest();  
     }
     catch (e)
     { 
         // Internet Explorer  
         try
         {    
               xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
         }
         catch (e)
         {    
               try
               {      
                     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");     
               }
               catch (e)
               {      
                     //alert("Your browser does not support AJAX!");      
                     return false;      
               }    
         }  
     }
   
     xmlHttp.onreadystatechange=function()
     {
         if(xmlHttp.readyState==4)
         {
               //document.getElementById("txt").value=xmlHttp.responseText;
         }
     }
	 sURL = sURL + "?" + "cytf_popid=" + sCytf_popid + "&cytf_gene=" + sCytf_gene;
     xmlHttp.open("GET", sURL, true);
     xmlHttp.send(null);  
}
function ajaxcyt2001a_ins(sCytf_popid, sCytf_gene, sCytf_cytokine, sCytf_pfreq)
{
    var xmlHttp;
	var sURL = "ajaxcyt2001a_ins.asp";
	
	try
    {  
         // Firefox, Opera 8.0+, Safari  
         xmlHttp=new XMLHttpRequest();  
     }
     catch (e)
     { 
         // Internet Explorer  
         try
         {    
               xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
         }
         catch (e)
         {    
               try
               {      
                     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");     
               }
               catch (e)
               {      
                     //alert("Your browser does not support AJAX!");      
                     return false;      
               }    
         }  
     }
   
     xmlHttp.onreadystatechange=function()
     {
         if(xmlHttp.readyState==4)
         {
               //alert(xmlHttp.responseText);
         }
     }
	 sURL = sURL + "?" + "cytf_popid=" + sCytf_popid + "&cytf_gene=" + sCytf_gene + "&cytf_cytokine=" + sCytf_cytokine + "&cytf_pfreq=" + sCytf_pfreq;
     xmlHttp.open("GET", sURL, true);
     xmlHttp.send(null);  
}
function ajaxcyt2001a_upt(sCytf_popid, sURL2, iAction)
{
    var xmlHttp;
	var sURL = "ajaxcyt2001a_upt.asp";
	var sResponse = "";
	
	if (iAction == 1)
		var bAgree=confirm("Do yo want to lock this record?");
	else
		var bAgree=confirm("Do yo want to unlock this record?");
		
	if (bAgree)
	{	
		try
		{  
			 // Firefox, Opera 8.0+, Safari  
			 xmlHttp=new XMLHttpRequest();  
		 }
		 catch (e)
		 { 
			 // Internet Explorer  
			 try
			 {    
				   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
			 }
			 catch (e)
			 {    
				   try
				   {      
						 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");     
				   }
				   catch (e)
				   {      
						 return false;      
				   }    
			 }  
		 }
	   
		 xmlHttp.onreadystatechange=function()
		 {
			 if(xmlHttp.readyState==4)
			 {
				   window.location="pop0009a.asp?" + sURL2;
				   //sResponse = xmlHttp.responseText;
				   //if(sResponse != "")
				   //{
					//	if (sResponse == "A")
					//	{
							//	document.getElementById("imgDelPop"+sCytf_popid).src="images/icon_active.gif";
							//	document.getElementById("imgStatPop"+sCytf_popid).src="images/icon_web.gif";								
					//	}
					//	else
					//	{
							//	document.getElementById("imgDelPop"+sCytf_popid).src="images/icon_inactive.gif";
							//	document.getElementById("imgStatPop"+sCytf_popid).src="images/icon_pending.gif";								
					//	}
				   //}
			 }
		 }
		 sURL = sURL + "?" + "cytf_popid=" + sCytf_popid;
		 xmlHttp.open("GET", sURL, true);
		 xmlHttp.send(null);  
	}
	else
	{
		return false;
	}
}

